<?php

?>
<!-- specials_products //-->
<?php
  /**
 * $info_box_contents = array();
 *   $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')));

 *   new contentBoxHeading($info_box_contents);
 */

  if ( (!isset($specials_products_category_id)) || ($specials_products_category_id == '0') ) {
    $specials_products_query = tep_db_query("select p.products_id,pd.products_description, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC limit 8" );
  } else {
    $specials_products_query = tep_db_query("select p.products_id,pd.products_description, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC limit 8");
  }
?>
<style type="text/css">
#easyTooltip{
	margin:0 10px 1em 0;
	width:450px;
	padding:8px;
	background:#fcfcfc;
	border:1px solid #e1e1e1;
	line-height:130%;	
    text-align: left;			
	}
#easyTooltip h3{
	margin:0 0 .5em 0;
	font:13px Arial, Helvetica, sans-serif;
	text-transform:uppercase;
	}	
#easyTooltip p{
	margin:0 0 .5em 0;
	}		
#easyTooltip img{
		background:#fff;
		padding:1px;
		border:1px solid #e1e1e1;
		float:left;
		margin-right:10px;
		}		

</style>

<div class="home-specbar">
                    <div class="lblTitle">Sản phẩm khuyến mãi</div>
                    <div class="lblViewall"><a href="products_specials.php" title="Xem thêm">Xem thêm</a></div>
                </div><br /><br /><br />
<?php
  $row = 0;
  $col = 0;
  $info_box_contents = array();
  $l=0;
  while ($specials_products = tep_db_fetch_array($specials_products_query)) {
    $l++;
    if ($new_price = tep_get_products_special_price($specials_products['products_id'])) {
        $products_price = '<s>' . $currencies->display_price($specials_products['products_price'], tep_get_tax_rate($specials_products['products_tax_class_id'])) . '</s><br /><span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($products_specials['products_tax_class_id'])) . '</span>';
    } else {
        $products_price = $currencies->display_price($specials_products['products_price'], tep_get_tax_rate($specials_products['products_tax_class_id']));
    }
        ?>
        <script type="text/javascript">
    	$(document).ready(function(){	
    		$('#thum<?php echo $specials_products['products_id'] ?>').easyTooltip({
    		  <?php if($l%3==0){ ?>
                xOffset: -400,	
                <?php }else{ ?>
                xOffset: -20,
                <?php } ?>
    			useElement: 'product<?php echo $specials_products['products_id'] ?>'				   
    		});
    	});
//showtooltip('#thum<?php echo $specials_products['products_id'] ?>','#product<?php echo $specials_products['products_id'] ?>');
</script>
        <div id="thum<?php echo $specials_products['products_id'] ?>"  class="product">
        <div class="product-thumb">
            <a href="<?php echo tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $specials_products['products_id']) ?>" title="<?php echo $specials_products['products_name'] ?>"><?php echo tep_image(DIR_WS_IMAGES . $specials_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) ?></a>
        
       
         
        </div>
         <div class="product-price">
            <?php echo $products_price;//$currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])); ?>
        </div>
        
        <div class="product-tit">
            <a href="<?php echo tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $specials_products['products_id']) ?>" title="<?php echo $specials_products['products_name'] ?>"><?php echo $specials_products['products_name'] ?></a>
        </div>
        
        <div align="center" style="width: 187px;    ">
        <a href="<?php echo tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $specials_products['products_id']) ?>" title="<?php echo $specials_products['products_name'] ?>">
           <input type="button" value="Chi tiết" title="Chi tiết" id="checkout" class="checkout">
        </a>
        
        <a href="<?php echo tep_href_link('index.php', 'action=buy_now&products_id=' . $specials_products['products_id']) ?>">
            <input type="button" value="Mua" title="Mua" id="checkout" class="checkout">
        </a>
        
        </div>
        </div>
         <div style="display: none;" id="product<?php echo $specials_products['products_id'] ?>">
        <h3><?php echo $specials_products['products_name'] ?></h3>
	<?php echo tep_image(DIR_WS_IMAGES . $specials_products['products_image'], $specials_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) ?>
	<p><?php echo nl2br($specials_products['products_description']) ?></p>

    </div>
<?php
   /* $info_box_contents[$row][$col] = array('align' => 'center',
                                           'params' => 'class="smallText" width="33%" valign="top"',
                                           //'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $specials_products['products_image'], $specials_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials_products['products_id']) . '">' . $specials_products['products_name'] . '</a><br>' . $currencies->display_price($specials_products['products_price'], tep_get_tax_rate($specials_products['products_tax_class_id'])));
                                           'text' => '<div class="product"><div class="product-thumb"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials_products['products_id']) . '" title="'.$specials_products['products_name'].'">' . tep_image(DIR_WS_IMAGES . $specials_products['products_image'], $specials_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></div><a href="'.tep_href_link('index.php', 'action=buy_now&products_id=' . $specials_products['products_id']).'">'.tep_image_button('button_in_cart.gif', 'Thêm vào giỏ','class="proceedbtn"').'<br /></a><div class="product-price">'.$products_price.'</div><div class="product-tit"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials_products['products_id']) . '" title="'.$specials_products['products_name'].'">' . $specials_products['products_name'] . '</a></div></div>');

    $col ++;
    if ($col > 2) {
      $col = 0;
      $row ++;
    }*/
  }

  //new contentBox($info_box_contents);
?>
<!-- specials_products_eof //-->